import Home from '../views/Home'
import Login from '../views/Login'
import Register from '../views/Register'
import Search from '../views/Search'
import Detail from '../views/Detail'

const routes = [
  {
    name: 'home',
    path: '/home',
    component: Home,
    meta: {
      isHiddenNav: true, //这个就相当于一个标识符，判断是home组件还是search组件
    },
  },
  {
    name: 'login',
    path: '/login',
    component: Login,
    meta: {
      isHiddenFooter: true,
    },
  },
  {
    name: 'register',
    path: '/register',
    component: Register,
    meta: {
      // 路由元信息 来添加自定义的属性存储一些信息等等
      isHiddenFooter: true,
    },
  },
  {
    name: 'search',
    // path: '/search',//这个是用query传参的形式
    path: '/search/:keyword?', // ?类似于正则中的? 表示有1个或是1个没有
    component: Search,
  },
  {
    path: '/', // 设置默认的页面
    redirect: '/home',
    // component: Home,
  },
  {
    name: 'detail',
    path: '/detail/:id',
    component: Detail,
  },
]

export default routes
